import { Form, Input, Modal } from "antd";
import React, { useState } from "react";

const AddRole: React.FC<any> = () => {
  const [formadd] = Form.useForm();
  const [isShow, setisShow] = useState(1);
  const addrole = () => {
    console.log("addrole");
  };
  const handleCancel = () => {
    // 隐藏对话框
    setisShow(0);
  };
  return (
    <Modal
      title="添加新的角色"
      visible={isShow === 1 ? true : false}
      onOk={addrole}
      onCancel={handleCancel}
    >
      {/* 这里收集输入的form也组件化了,和category在一个文件夹中 */}
      <Form form={formadd}>
        <Form.Item
          name="add"
          rules={[{ required: true, message: "请输入内容,不能为空。" }]}
        >
          <Input
            placeholder="请输入新的角色"
            type="text"
            value={"text"}
            style={{ width: 470 }}
          />
        </Form.Item>
      </Form>
    </Modal>
  );
};

export default AddRole;
